home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
glass
/
glass.lha
/
GLASS
/
glassme
/
gme04
< prev
next >
Wrap
Text File
|
1991-02-19
|
3KB
|
103 lines
MINUS 1 :: @minus 1 (x>).
minus 1 (m 1>):
^!! *(nr>),
compute (>nr+"-1",m 1>).
%TEX
\subsubsection{Do operations on integers VBuiltin}
%
INT INT to INT :: @ INT int to int (op>).
INT int to int (op>) : !*^! (op>), ->;
INT int to int ("%">) : "MOD",->;
INT int to int ("+">) : "+2",->;
INT int to int ("-">) : "-2".
int int to int(>dyadic,>a 1 * a 2 * _ ,>node):
where (>a1,ParInt* I NUM * val 1>),
where (>a2,ParInt* I NUM * val 2>),
dc (>val 1+" "+val 2+dyadic+"ps.\n",DC Result>),
repair (>node,>ParInt, >I NUM * DC Result ).
DC Result :: @ dc result (x>).
FLOAT FLOAT to FLOAT :: @ INT int to int (op>).
dc result ("_"+x>):
"-", ->, ^!!*(x>);
dc result (x>):
^!!*(x>).
%TEX
\subsubsection{Do operations on floats VBuiltin}
%
float float to float(>dyadic,>a 1 * a 2 * _,>node):
where (>a1,ParFlo* F NUM * val 1>),
where (>a2,ParFlo* F NUM * val 2>),
make exponent int (>dyadic,>val 2,v 2>),
dc (>val 1+" "+v 2+dyadic+"ps.\n",DC Result>),
repair (>node,>ParFlo, >F NUM * DC Result ).
make exponent int (>"^",>v,v 2>): ->,
real to int (>v,v 2>);
make exponent int (>x,>v,v>):.
%TEX
\subsubsection{Do any any to bool, float, int operations VBuiltin}
%
A A to BOOL :: @ A a to bool (op>).
A a to bool (op>) : !<>! (op>), ->;
A a to bool ("!>">) : "<=", ->;
A a to bool ("!<">) : ">=".
a a to int (>a 1* a 2 * _,>node):
where (> a 1 , t* f i num * val 1>),
where (> a 2 , s* f i num * val 2>),
dc (>val 1+" "+val 2+"/ 0kps.\n",DC Result>),
repair (>node,>ParInt , >I NUM * DC Result ).
a a to float (>a 1* a 2 * _ ,>node):
where (> a 1 , t* f i num * val 1>),
where (> a 2 , s* f i num * val 2>),
dc (>val 1+" "+val 2+"/ ps.\n",DC Result>),
repair (>node,>ParFlo , >F NUM * DC Result ).
a a to bool (>relation,>a 1 * a 2 * _ ,>node):
where (> a 1 , t* f i num * v 1>),
where (> a 2 , s* f i num * v 2>),
inverse relation (>relation,inverse>),
dc (>v 2+" "+v 1+relation+"x "+v 2 +" "+ v 1+inverse+"y\n",result a>),
repair (>node,>ParBool , >BOOL * result a ).
inverse relation (>"!"+r,r>):->;
inverse relation (>r,"!"+r>):.
%TEX
\subsubsection{Do boolean operations VBuiltin}
%
BOOL BOOL to BOOL :: @ BOOL bool to bool (op>).
BOOL bool to bool (x>) : !&|! (x>).
bool bool to bool (>dyadic,>arg 1 * arg 2*_, >node):
where (>arg 1,ParBool* BOOL * val 1>),
where (>arg 2,ParBool* BOOL * val 2>),
bool op (> dyadic,>val 1,>val 2,result a>),
repair (>node,>ParBool , > BOOL * result a ).
bool op (>"|",>v,>w,r>): ->,
bool or (>v,>w,r>);
bool op (>"&",>v,>w,r>):
bool and (>v,>w,r>).